package stats;

import java.util.HashMap;
import java.util.Map;

public class HashMapStatsService implements IStatsService
{
	private Map<String, Long>	stats	= new HashMap<String, Long>(5000, 1);

	public void notify ( String key )
	{
		Long value = 1l;
		synchronized (stats)
		{
			if (stats.containsKey(key))
			{
				value = stats.get(key) + 1;
			}
			stats.put(key, value);
		}
	}

	public Map<String, Number> getStats ( )
	{
		Map<String, Number> copy;
		synchronized (stats)
		{
			copy = new HashMap<String, Number>(stats);
			stats.clear();
		}
		return copy;
	}

	public void stop ( )
	{
	// TODO Auto-generated method stub

	}
}
